const Sequelize = require("sequelize");
const db = require('../DBConfig/config');
const User = require("./user");

const StrategyList = db.define('strategy_list', {
    id: {
        type: Sequelize.INTEGER(11),
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
    },
    content: {
        type: Sequelize.TEXT,
    },
    create_time: {
        type: Sequelize.DATE,
    },
    update_time: {
        type: Sequelize.DATE
    },
    author: {
        type: Sequelize.TEXT
    },
    pics: {
        type: Sequelize.TEXT
    }
}, {
    freezeTableName: true,
    timestamps: false
})

StrategyList.belongsTo(User, { targetKey: 'openid', foreignKey: 'author' });

module.exports = StrategyList;